<!--
 * @Author: fengYM feng25321@163.com
 * @Date: 2023-09-21 16:38:46
 * @LastEditors: fengYM feng25321@163.com
 * @LastEditTime: 2023-10-11 14:44:41
 * @Description: 首页
-->
<template>
  <view class="">
    <view class="header">首页 </view>
    <view class="main">
      <u-swiper :list="bannerList" indicator height="175" @click="swiperClick" img-mode="scaleToFill"></u-swiper>
      <view class="noticeBox">
        <view class="iconBox">公告</view>
        <u-notice-bar :text="notice" bg-color="" color="#333333" icon="" mode="link"></u-notice-bar>
      </view>
      <view class="adBox">
        <view>
          <view class="t">申请联营商</view>
          <view class="b" @click="goPage('/pages/myPage/proxyApply')">立即申请</view>
        </view>
        <img src="../../static/ad.png" alt="" />
      </view>
      <view class="smallBox">
        <view class="title">我的余额</view>
        <view class="con">
          <view>200.00</view>
          <u-icon name="arrow-right"></u-icon>
        </view>
      </view>
      <view class="smallBox box">
        <view class="title">我的余额</view>
        <view class="itemList">
          <view @click="goPage('/pages/home/lyfrPage')">
            <view class="num">20.00</view>
            <view class="label">联营分润 <u-icon name="arrow-right" size="14" color="#A5A5A5"></u-icon></view>
          </view>
          <view @click="goPage('/pages/myPage/myWallet')">
            <view class="num">20.00</view>
            <view class="label">辅导津贴 <u-icon name="arrow-right" size="14" color="#A5A5A5"></u-icon></view>
          </view>
          <view>
            <view class="num">20.00</view>
            <view class="label">优先分润 <u-icon name="arrow-right" size="14" color="#A5A5A5"></u-icon></view>
          </view>
        </view>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { onBeforeMount, ref } from "vue";
import { goPage } from "../../utils/commonFn";
const notice = ref("");
const bannerList = ref<string[]>([]);
const swiperClick = (e: any) => {
  if (bannerList.value[e]) {
    uni.navigateTo({
      url: `/pages/home/bannerAdPage?imgUrl=${bannerList.value[e]}`,
    });
  }
};
</script>

<style lang="less" scoped>
.header {
  font-size: 40rpx;
  font-family: PingFangSC, PingFang SC;
  font-weight: 600;
  color: #ffffff;
  box-sizing: border-box;
  padding: 40rpx 25rpx;
  height: 348rpx;
}
.main {
  margin-top: -220rpx;
  .noticeBox {
    margin-top: 20rpx;
  }
}
.adBox {
  margin-top: 2vh;
  background: linear-gradient(135deg, #224ed4 0%, #191d83 100%);
  border-radius: 16rpx;
  position: relative;
  padding: 24rpx 40rpx;
  margin-top: 40rpx;
  img {
    position: absolute;
    right: 20rpx;
    bottom: 14rpx;
    width: 196rpx;
    height: 184rpx;
  }
  .t {
    font-size: 20px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #ffffff;
  }
  .b {
    font-size: 12px;
    font-family: PingFangSC-Medium, PingFang SC;
    font-weight: 500;
    color: #818998;
    margin-top: 8px;
    color: #fff;
    width: 144rpx;
    height: 36rpx;
    background: #127ffe;
    border-radius: 24rpx;
    text-align: center;
  }
}
.smallBox {
  background: #ffffff;
  border-radius: 16rpx;
  padding: 36rpx;
  margin-bottom: 20rpx;
  .title {
    font-size: 28rpx;
    font-family: PingFangSC, PingFang SC;
    font-weight: 500;
    color: #333333;
    position: relative;
    padding-left: 25rpx;
    font-weight: bold;
    &::before {
      position: absolute;
      content: "";
      width: 8rpx;
      height: 32rpx;
      left: 1rpx;
      top: 4rpx;
      background: #5e49f2;
      border-radius: 16rpx;
    }
  }
  .con {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 40rpx 0;
    font-size: 64rpx;
    font-family: DINPro, DINPro;
    font-weight: bold;
    color: #333333;
    line-height: 82rpx;
  }
}
.box {
  .title {
    &::before {
      background: #f8ad52;
    }
  }
  .itemList {
    width: 90%;
    margin: 0 auto;
    margin-top: 20rpx;
    display: flex;
    align-items: center;
    justify-content: space-between;
    text-align: center;
    .num {
      font-size: 40rpx;
      font-family: DINPro, DINPro;
      font-weight: bold;
      color: #333333;
      line-height: 52rpx;
    }
    .label {
      display: flex;
      align-items: center;
      font-size: 24rpx;
      font-family: PingFangSC, PingFang SC;
      font-weight: 400;
      color: #a5a5a5;
      line-height: 34rpx;
      margin-top: 10rpx;
    }
  }
}
</style>
